#!/bin/sh
# 
# Usage: ccalpdf [-g|-b] [-o file] [[month] year]
# Generates PDF calendar with Chinese calendars
#
OPTIONS=""
OUTPUT="-"
while true
do
	case "$1" in
	-o) OUTPUT="$2" shift ;;
	-?*) OPTIONS="$OPTIONS $1" ;;
	*)  break ;;
	esac
        shift
done
OPTIONS="$OPTIONS -p"

if [ $# -gt 2 ]; then
        echo "Usage: ccalpdf [-g|-b] [-o file] [[month] year]" 1>&2
        exit 1
fi

ccal $OPTIONS $* |ps2pdf - $OUTPUT

